surface: Add a scale-factor property
authorMatthias Clasen <mclasen@redhat.com>
Sat, 16 Jan 2021 20:16:36 +0000 (15:16 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 16 Jan 2021 20:22:46 +0000 (15:22 -0500)
This will allow us to notify when the scale changes.

gdk/gdksurface.c

index 35c47a34769420ff1dddb0da655ae72b2d74b7ff..ec48ad3543e3bfab203627626a7d38a29c22eef3 100644 (file)
@@ -92,6 +92,7 @@ enum {
   PROP_MAPPED,
   PROP_WIDTH,
   PROP_HEIGHT,
+  PROP_SCALE_FACTOR,
   LAST_PROP
 };
 
@@ -551,6 +552,13 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
                         0, G_MAXINT, 0,
                         G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
 
+  properties[PROP_SCALE_FACTOR] =
+      g_param_spec_int ("scale-factor",
+                        P_("Scale factor"),
+                        P_("Scale factor"),
+                        1, G_MAXINT, 1,
+                        G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
+
   g_object_class_install_properties (object_class, LAST_PROP, properties);
 
   /**
@@ -782,6 +790,10 @@ gdk_surface_get_property (GObject    *object,
       g_value_set_int (value, surface->height);
       break;
 
+    case PROP_SCALE_FACTOR:
+      g_value_set_int (value, gdk_surface_get_scale_factor (surface));
+      break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;